home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / Pedestal / Source / Sources / Views / PedViewScrollerTE.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  1.5 KB  |  97 lines

  1. /*    ====================
  2.  *    PedViewScrollerTE.cc
  3.  *    ====================
  4.  */
  5.  
  6. #include "PedestalDebugging.h"
  7.  
  8. #include "PedViewScrollerTE.hh"
  9. #include "PedPaneSubView.hh"
  10. #include "PedViewScroll.hh"
  11. #include "PedScrollbar.hh"
  12. #include "PedPaneTE.hh"
  13.  
  14.  
  15. PedViewScrollerTE::PedViewScrollerTE(PedPaneSubView &inSuperPane)
  16. : PedViewScroller(inSuperPane), mPane(NULL)
  17. {
  18.     mPane = new PedPaneTE(*this);
  19.     //mPane->Resize(mFrame.right - 15, mFrame.bottom - 15);
  20. }
  21.  
  22. PedViewScrollerTE::~PedViewScrollerTE()
  23. {
  24.     if (mPane) mPane->release();
  25. }
  26.  
  27. void
  28. PedViewScrollerTE::Dispose()
  29. {
  30.     PedViewScroller::Dispose();
  31.     if (mPane) {
  32.         mPane->Dispose();
  33.         mPane->release();
  34.         mPane = NULL;
  35.     }
  36. }
  37.  
  38.  
  39. PedPane *
  40. PedViewScrollerTE::Pane()
  41. {
  42.     return mPane;
  43. }
  44.  
  45. PedPane *
  46. PedViewScrollerTE::MyPane()
  47. {
  48.     return mPane;
  49. }
  50.  
  51.  
  52. void 
  53. PedViewScrollerTE::SetPane(PedPaneTE *inPane)
  54. {
  55.     PedPaneTE *oldPane = mPane;
  56.     if (inPane) inPane->retain();
  57.     mPane = inPane;
  58.     if (oldPane) oldPane->release();
  59.     
  60.     mPane->Resize(mFrame.right  - (mScrollV ? 15 : 0), 
  61.                   mFrame.bottom - (mScrollH ? 15 : 0));
  62.     Calibrate();
  63. }
  64.  
  65.  
  66. void
  67. PedViewScrollerTE::Scroll(short inH, short inV, bool inUpdate)
  68. {
  69.     if (mPane) {
  70.         mPane->Scroll(inH, inV, inUpdate);
  71.     }
  72.     Calibrate();
  73. }
  74.  
  75.  
  76. void
  77. PedViewScrollerTE::GetAperture(Rect &outAperture)
  78. {
  79.     GetFrame(outAperture);
  80.     if (mScrollV) {
  81.         outAperture.right -= 15;
  82.     }
  83.     if (mScrollH) {
  84.         outAperture.bottom -= 15;
  85.     }
  86. }
  87.  
  88. void
  89. PedViewScrollerTE::GetScrollPos(Point &outPos)
  90. {
  91.     if (mPane) {
  92.         mPane->GetScrollPos(outPos);
  93.     } else {
  94.         ::SetPt(&outPos, 0, 0);
  95.     }
  96. }
  97.